﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Alex.Library.Cloud.Libs;

namespace Alex.Library.Cloud.VMWare.V51.VMMParameters
{
    public class CreateUserParameter : IVMMParameter
    {
        public CreateUserParameter(string newUserName, string newPassword)
        {
            this.NewUserName = newUserName;
            this.NewPassword = newPassword;
        }

        public CreateUserParameter()
            : this(string.Empty, string.Empty)
        {

        }

        public string NewUserName { get; set; }
        public string NewPassword { get; set; }

        public bool IsValid()
        {
            bool isValid = true;
            StringBuilder sb = new StringBuilder();
            if (String.IsNullOrEmpty(NewUserName))
            {
                sb.AppendLine("NewUserName is empty or null.");
                isValid = false;
            }
            if (String.IsNullOrEmpty(NewPassword))
            {
                sb.AppendLine("NewPassword is empty or null.");
                isValid = false;
            }
            ErrorMessage = sb.ToString();
            return isValid;
        }

        public string ErrorMessage { get; private set; }
    }
}
